// package com.zmn.plat.services.config;
//
// import com.alibaba.druid.pool.DruidDataSource;
// import org.apache.ibatis.io.VFS;
// import org.apache.ibatis.plugin.Interceptor;
// import org.apache.ibatis.session.SqlSessionFactory;
// import org.mybatis.spring.SqlSessionFactoryBean;
// import org.mybatis.spring.SqlSessionTemplate;
// import org.mybatis.spring.annotation.MapperScan;
// import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
// import org.springframework.beans.factory.annotation.Qualifier;
// import org.springframework.boot.context.properties.ConfigurationProperties;
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
// import org.springframework.context.annotation.Primary;
// import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
// import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
// import javax.sql.DataSource;
//
/// **
// * @author nowind
// * Date: 2018/09/11 13:59
// */
// @Configuration
// @MapperScan(basePackages = {"com.zmn.plat.persistence.interfaces"}, sqlSessionTemplateRef = "basePlatSqlSessionTemplate")
// public class BasePlatDataSourceConfig {
//
// @Bean(name = "basePlatDataSource")
// @ConfigurationProperties(prefix = "spring.datasource.plat")
// @Primary
// public DataSource platDataSource() {
// return new DruidDataSource();
// }
//
// @Bean(name = "basePlatSqlSessionFactory")
// @Primary
// public SqlSessionFactory testSqlSessionFactory(@Qualifier("basePlatDataSource") DataSource dataSource) throws Exception {
// SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//// ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
// bean.setConfigLocation(new PathMatchingResourcePatternResolver().getResource("classpath:spring-plat-mybatis.xml"));
// bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/**/*.xml"));
//// bean.setMapperLocations(getResources("classpath*:mapper/area/*.xml", "classpath*:mapper/log/*.xml", "classpath*:mapper/mc/**/*.xml"
//// , "classpath*:mapper/news/*.xml", "classpath*:mapper/organize/*.xml", "classpath*:mapper/sms/*.xml", "classpath*:mapper/spare/*.xml",
// "classpath*:mapper/talk/*.xml"
//// ));
//
// VFS.addImplClass(SpringBootVFS.class); //解决 java -jar plat-dubbo.jar 运行报错mybatis class not found问题
//
// bean.setTypeAliasesPackage("com.zmn.plat.model.entity,com.zmn.common.dto");
// bean.setDataSource(dataSource);
//
// //CAT 插件
//// bean.setPlugins(new Interceptor[]{new CatMybatisPlugin()});
// return bean.getObject();
// }
//
// @Bean(name = "basePlatTransactionManager")
// @Primary
// public DataSourceTransactionManager testTransactionManager(@Qualifier("basePlatDataSource") DataSource dataSource) {
// return new DataSourceTransactionManager(dataSource);
// }
//
// @Bean(name = "basePlatSqlSessionTemplate")
// @Primary
// public SqlSessionTemplate testSqlSessionTemplate(@Qualifier("basePlatSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws
// Exception {
// return new SqlSessionTemplate(sqlSessionFactory);
// }
//
//
// }
